package cn.com.cetccst.datacenter.message.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;

import java.util.List;

import cn.com.cetccst.datacenter.collection.dao.BaseDao;
import cn.com.cetccst.datacenter.message.entity.InboxMessageEntity;

//我的-消息通知Dao
@Dao
public interface InboxMessageDao extends BaseDao<InboxMessageEntity> {

    @Query("select * from " + InboxMessageEntity.TABLE_NAME)
    LiveData<List<InboxMessageEntity>> getAll();

    @Query("select count(*) from " + InboxMessageEntity.TABLE_NAME + " where read = 0")
    LiveData<Integer> unreadCount();

    @Query("update " + InboxMessageEntity.TABLE_NAME + " set read = 1")
    void readAll();
}
